import Vue from 'vue';
import Router from 'vue-router';
import routerList from './routers';

/**
 * @Author: pjji
 * @Description: 处理重复点击导航列，控制台报错
 */
// const initPushMethod = Router.prototype.push;
// Router.prototype.push = function push(location) {
//     return initPushMethod.call(this, location).catch(err => err)
// };


Vue.use(Router)

const router = new Router(routerList)
// 根据路由设置标题
router.beforeEach((to, from, next) => {
    if (to.meta.title) {
        document.title = to.meta.title
    }
    next();
})

export default router;